<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,initial-scale1,maximum-scale=1">
    <title>采购订单</title>
    <link rel="shortcut icon" th:href="@{/pages/logo-1.ico}" href="../static/pages/logo-1.ico"/>
    <link rel="stylesheet" href="../static/layui/css/layui.css" th:href="@{/layui/css/layui.css}">
    <link rel="stylesheet" href="../static/layui/css/log.css" th:href="@{/layui/css/log.css}">
    <link rel="stylesheet" href="../static/lyear/css/style.min.css" th:href="@{/lyear/css/style.min.css}">
    <link rel="stylesheet" href="../static/lyear/css/bootstrap.min.css" th:href="@{/lyear/css/bootstrap.min.css}">
    <link rel="stylesheet" href="../static/lyear/css/materialdesignicons.min.css" th:href="@{/lyear/css/materialdesignicons.min.css}">
</head>
<body class="layui-layout-body">
<div class="layui-layout layui-layout-admin">
    <!--头部信息-->
    <div th:replace="common/topbar::#topbarheader"></div>
    <!--左侧导航-->
    <div th:replace="common/leftbar::#leftbaraside"></div>
    <div class="layui-body " style="background-color: rgba(233,234,234,0.85)">
        <!-- 内容主体区域 -->
        <i class=""></i> <a href="index.html" th:href="@{/login/index}" class="layui-icon layui-icon-home">首页</a>
        <span class="layui-icon">&gt;</span>
        <span class="">采购管理</span>
        <span class="">&gt;</span>
        <span class="">采购订单</span>


        <!-- 文档列表 -->

            <div class="container-fluid" >

                <div class="row" >
                    <div class="col-lg-12">
                        <div class="card"style="background-color: rgba(247,248,250,0.58)">
                            <div class="card-toolbar clearfix">
                                    <div class="input-group">
                                        <div class="input-group-btn">
                                        </div>
                                    </div>
                                <div class="toolbar-btn-action">
<!--                                    <a class="btn btn-danger" href="#!"><i class="mdi mdi-window-close"></i> 批量删除</a>-->
                                    <a class="btn btn-primary m-r-5" href="addsp.html" th:href="@{/pur/addsp}"><i class="mdi mdi-plus"></i> 添加商品</a>
                                    <a class="btn btn-primary m-r-5" href="adddd.html" th:href="@{/pur/adddd}"><i class="mdi mdi-plus"></i>添加订单</a>
                                </div>
                            </div>
                            <div class="card-body">

                                <div class="table-responsive">
                                    <table class="table table-bordered">
                                        <thead>
                                        <tr>
                                            <th>
                                                <label class="lyear-checkbox checkbox-primary">
                                                    <input type="checkbox" id="check-all"><span></span>
                                                </label>
                                            </th>
                                            <th>序号</th>
                                            <th>采购订单ID</th>
                                            <th>商品ID</th>
                                            <th>供应商ID</th>
                                            <th>支付方式</th>
                                            <th>采购时间</th>
                                            <th>数量</th>
                                            <th>总金额</th>
                                            <th>操作</th>
                                        </tr>
                                        </thead>
                                        <tbody id="num">
                                        <tr th:each="page1:${page1}">
                                            <td>
                                                <label class="lyear-checkbox checkbox-primary">
                                                    <input type="checkbox" name="ids[]" value="1"><span></span>
                                                </label>
                                            </td>
                                            <td id="xh" name="xh"></td>
                                            <td th:text="${page1.id}" id="id" name="id"></td>
                                            <td th:text="${page1.goodsId}"></td>
                                            <td th:text="${page1.suppliersId}"></td>
                                            <td th:text="${page1.pay}"></td>
                                            <td th:text="${page1.inDate}"></td>
                                            <td th:text="${page1.count}"></td>
                                            <td th:text="${page1.total}"></td>
                                            <td>
                                                <div class="layui-btn-group" >
                                                    <a class="layui-btn layui-btn-sm" href="#!" th:href="@{'/pur/addddcz/' + ${page1.id}}" title="编辑" data-toggle="tooltip"><i class="mdi mdi-pencil">编辑</i></a>
                                                    <a class="layui-btn layui-btn-sm layui-btn-danger" href="#!" id="deleteCgdd" th:href="@{'/pur/purcgddDelete/' + ${page1.id}}" title="退货" data-toggle="tooltip"><i class="mdi mdi-window-close">退货</i></a>
                                                </div>
                                            </td>
                                        </tr>
                                        </tbody>
                                    </table>
                                </div>
                                <ul class="pagination">
                                    <li><a href = "/purchase/multipage?curPage=1" th:href="'/pur/purcgdd?page=0'" >首页</a></li>
                                    <li th:if="${page1.hasPrevious()}">
                                        <a href = "/purchase/multipageDown?curPage=${currentPage}" th:href="'/pur/purcgdd?page=' + ${page1.previousPageable().getPageNumber()} ">上一页</a>
                                    </li>
                                    <li><a>第<text th:text="${(page1.number)+1}"></text>页/共<text th:text="${page1.totalPages}"></text>页</a></li>
                                    <li th:if="${page1.hasNext()}">
                                        <a href = "/purchase/multipageUp?curPage=${currentPage}" th:href="'/pur/purcgdd?page=' + ${page1.nextPageable().getPageNumber()}">下一页</a>
                                    </li>
                                    <li><a href = "/purchase/multipage?curPage=${totalPage}" th:href="'/pur/purcgdd?page=' + ${(page1.getTotalPages())-1}">尾页</a></a></li>
                                </ul>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
<!--        <input type="hidden" name="deleteCgdd1" id="deleteCgdd1" th:value="${deleteCgdd1}"/>&lt;!&ndash;删除弹窗&ndash;&gt;-->
<!--        <input type="hidden" id="page" th:value="${(page1.number)}"/>&lt;!&ndash;页数&ndash;&gt;-->
        <!--内容根部-->
    </div>
</div>
<script src="../static/js/jquery-3.6.3.min.js" th:src="@{/js/jquery-3.6.3.min.js}" type="text/javascript"></script>
<script src="../static/layui/layui.js" th:src="@{/layui/layui.js}" type="text/javascript"></script>
<script src="../static/js/vue.min.js" th:src="@{/js/vue.min.js}" type="text/javascript"></script>
<script th:inline="javascript">
    //Javascript代码区域
    window.onload=function() {
        // console.log("11111S")
        // let user = [[${user}]];
        // if (user==null || user==0){
        //     window.location.href = "/";
        // }
        let deleteCgdd1 = [[${deleteCgdd1}]];
        if (deleteCgdd1!=0 && deleteCgdd1!=null) {
            layer.open({
                title: ''
                , content: '采购订单'+ deleteCgdd1+'退货成功'
            });
        }else if (deleteCgdd1==-1){
            layer.open({
                title: ''
                , content: '库存不足!'
            });
        }else if (deleteCgdd1==-2){
            layer.open({
                title: ''
                , content: '系统错误，请联系管理员!'
            });
        }
        //序号
        var page = [[${page1}]]; <!--接收值-->
        let size= 5;//每页条数
        let a = page.number*size;
        let b = 0;
        var oTable = document.getElementById("num");
        for(let i=a;i<a+oTable.rows.length;i++){
            // console.log("33333")
            oTable.rows[b].cells[1].innerHTML = (i+1);
            b++;
        }
    }
</script>
</body>
</html>
